package com.starwish.starwishblog.mapper;

import com.starwish.starwishblog.entity.Permission;
import com.starwish.starwishblog.vo.MenuVo;
import com.starwish.starwishblog.vo.PermissionVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PermissionMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(PermissionVo permissionVo);

    Permission selectByPrimaryKey(Integer id);

    List<Permission> selectAll();

    int updateByPrimaryKey(PermissionVo permissionVo);

    List<MenuVo> selectAllMenus();

    List<PermissionVo> selectPermissionsByCons(@Param("name")String name);

    List<PermissionVo> selectParentPermissions();

    @Delete("delete from t_role_url_permission where url_permission_id = #{value}")
    int deleteRoleAndPermissionByPermissionId(Integer id);

    List<MenuVo> selectMenuByName(String name);
}